package com.qs.entities;

import java.sql.Timestamp;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

@Entity
@Table(name="UserSession")
public class UserSession implements java.io.Serializable {

	private static final long serialVersionUID = -1103094354093998660L;
	
	public UserSession(){
		
	}
	
	public UserSession(String id){
		this.sessionId = id;
	}
		
	@Id
	@Column(name="session_id")
	public String sessionId;
	
	@ManyToOne
	@JoinColumn(name="user_id")
	public User user;
	
	@Column(name="last_accessed")
	public Timestamp lastAccessed = new Timestamp((new Date()).getTime());;
	
	@Column(name="is_expired")
	public Boolean isExpired = false;
	
	@Column(name="created_on")
	public Timestamp createdOn = new Timestamp((new Date()).getTime());	
}